<template>

  <div class="event_detail">
    <div class="event_detail_list">

      <div class="titles">
        <div class="titles_left">
          <span class="title_desc">走访人</span>
          <span class="title_desc">走访人数</span>
          <span class="title_desc">走访内容</span>
        </div>
        <div class="titles_right" style="padding-left: -1px">
          <span class="title_desc font_hidden" style="margin-right: 0px">事件类型</span>
          <span class="title_desc" style="margin-left: 40px">走访日期</span>
        </div>
      </div>

      <NoData v-if="list.length==0"></NoData>

      <div v-for="item in list">
        <div class="list_step" @click="CheckDetail(item.id)">
          <div class="step_left">
            <span class="grid_name">{{item.visit_user | null3Text}}</span>
            <span class="event" style="width: 160px;box-sizing: border-box;">共{{item.interview_count}}人</span>
            <span class="content">{{item.content | null3Text}}</span>
          </div>
          <div class="step_right">
            <span class="event font_hidden" style="padding-left: 0px;">无事件类型</span>
            <span class="time">{{item.time | null3Text}}</span>
          </div>
        </div>
      </div>

    </div>
    <div class="pages-box">
      <el-pagination
        background
        layout="prev, pager, next"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  import default_img from '../../../assets/images/default.png'
  import NoData from '../../../components/nodata/NoData'

  export default {
    name: "visit",
    data() {
      return {
        uid: this.$route.query.uid,
        name: this.$route.query.name,
        page: 1,
        limit: 10,
        list: [],
        total: 0,
        flag: false,//是否显示暂无数据，默认不显示
      }
    },
    components: {
      NoData
    },
    created() {
      console.log('this.$router.query11111:', this.$route.query);

      console.log('到这里了')
      this.$emit("childData", this.$route.query.childdata);
      this.default_img = default_img;
    },

    mounted() {
      this.getData();
    },

    methods: {
      CheckDetail(id) {
        let that = this;
        that.$router.push({
          path: '/event_detail',
          query: {id: id, pid: that.$route.query.pid, childdata: that.$route.query.childdata, step: '走访'}
        });
      },

      getData() {
        console.log('进函数')
        let that = this;
        let params = {
          vollege_id: that.$util.vollege_id,
          page: this.page,
          limit: this.limit
        }
        that.$http.get("api/GriderPcApi/getVisitListNew",params, r => {
          console.log('AAQQ:', r);
          this.total = r.data.count;
          that.list = r.data.list;
          if (r.data.length == 0) {
            that.flag = true;
          }
        })
      },
      handleSizeChange: function (size) {
        this.pagesize = size;
        console.log(this.pagesize)  //每页下拉显示数据
      },
      handleCurrentChange: function (currentPage) {
        this.page = currentPage;
        console.log('哪一页：', this.page)  //点击第几页
        this.getData()
      },
    }
  }
</script>

<style scoped>
  .pages-box {
    position: absolute;
    bottom: 5px;
    left: 80px;
  }

  .event_detail {
    height: 620px;
    width: 100%;
    box-sizing: border-box;
    /*padding-top: 60px;*/
  }

  .event_detail_list {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    padding-left: 5px;
    padding-right: 5px;
    /*display: flex;*/
    /*flex-direction: column;*/
  }

  .titles {
    height: 80px;
    width: 100%;
    box-sizing: border-box;
    padding-left: 60px;
    padding-right: 60px;
    display: flex;
    align-items: center;

  }

  .titles_left {
    /*flex: 1.7;*/
    flex: 3.1;
  }

  .title_desc {
    font-size: 28px;
    color: black;
    font-family: 微软雅黑;
    font-weight: bold;
    margin-right: 40px;
  }

  .titles_right {
    flex: 1.1;
  }

  .list_step {
    height: 80px;
    width: 100%;
    display: flex;
  }

  .step_left {
    /*flex: 1.8;*/
    flex: 3.2;
    color: black;
    font-size: 22px;
    display: flex;
    align-items: center;
  }

  .grid_name {
    display: block;
    width: 128px;
    padding-left: 2px;
  }

  .event {
    display: block;
    width: 154px;
    padding-left: 12px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  .content {
    padding-left: 4px;
    overflow: hidden;
    width: 530px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }


  .step_right {
    flex: 1.1;
    color: black;
    font-size: 22px;
    display: flex;
    align-items: center;
  }

  .status {
    display: block;
    width: 130px;
    margin-right: 27px;
  }

  .guiji {
    display: block;
    width: 155px;
  }

  .check_guiji {
    width: 120px;
    height: 38px;
    line-height: 38px;
    background: #21bd7e;
    color: white;
    border-radius: 8px;
    text-align: center;
  }


  .list_step:nth-child(odd) {
    box-sizing: border-box;
    padding-left: 60px;
    padding-right: 60px;
    background: #ffffff;
  }

  .list_step:nth-child(even) {
    padding-left: 60px;
    padding-right: 60px;
    background: #f8f8f8;
  }


  .yes {
    color: #29be74;
    /*padding-left: 11px;*/
  }

  .no {
    color: #ff3b30;
    padding-left: 11px;
  }

  .font_hidden {
    color: transparent !important;
  }


</style>
